<template>
    <div class="header">
        <div class="logo">
            <img src="../../assets/logo.png" alt="">
            <span>应急食品</span>
        </div>
        <ul class="menu-box">
            <li class="menu-li" style="color: #4187f6">个人问卷</li>
            <li class="menu-li">帮助与支持</li>
        </ul>
        <router-link to="/login" class="user-login" title="退出登录" replace>{{user}}</router-link>
    </div>
</template>

<script>
export default {
    data(){
        return {
            
        }
    },
    computed: {
        user(){
            if(this.$route.query.username){
                return this.$route.query.username
            }
            else{
                return sessionStorage.getItem('username')
            }
        }
    }
}
</script>

<style scoped>
.header{
    display: flex;
    height: 10vh;
    background-color: #2b343b;
    color: #fff;
    justify-content: flex-start;
}

a{
    color: #fff;
    text-decoration: none;
}

li{
    list-style: none;
}

.logo{
    width: 15vw;
    height: 10vh;
    margin: 0 20px;
    font-size: 2rem;
    text-align: center;
    line-height: 10vh;
}

.logo > img{
    display: block;
    position: absolute;
    width: 10vh;
    height: 10vh;
    left: 50px;
    float: right;
}

.logo > span{
    display: block;
    position: absolute;
    height: 10vh;
    left: calc(60px + 10vh);
    line-height: 10vh;
    font-size: 1.5rem;
    float: right;
}

.menu-box{
    display: flex;
    width: 70vw;
    height: 10vh;
    margin-left: 50px;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
}

.menu-li{
    width: 120px;
    height: 10vh;
    line-height: 10vh;
    margin-right: 20px;
    cursor: pointer;
}

.menu-li:hover{
    color: #4187f6;
}

.user-login{
    display: block;
    width: 15vw;
    height: 10vh;
    margin: 0 20px;
    font-size: 1.3rem;
    text-align: center;
    line-height: 10vh;
}
</style>